import request from '@/utils/request'

import { lifeServiceApi } from '../config'

const baseApi = '/wishes'

export function create(data) {
  return request({
    url: lifeServiceApi + baseApi,
    method: 'POST',
    data
  })
}

export function getPageList(params) {
  return request({
    url: lifeServiceApi + baseApi + '/page',
    method: 'GET',
    params
  })
}

export function getList(params) {
  return request({
    url: lifeServiceApi + baseApi,
    method: 'GET',
    params
  })
}

export function getById(id) {
  return request({
    url: lifeServiceApi + baseApi + `/${id}`,
    method: 'GET'
  })
}

export function removeById(id) {
  return request({
    url: lifeServiceApi + baseApi + `/${id}`,
    method: 'DELETE'
  })
}

export function updateStar(id, star) {
  return request({
    url: lifeServiceApi + baseApi + `/${id}/star`,
    method: 'Patch',
    data: {
      star
    }
  })
}

export function updateCost(id, cost) {
  return request({
    url: lifeServiceApi + baseApi + `/${id}/cost`,
    method: 'Patch',
    data: {
      cost
    }
  })
}

export function updateStatus(id, status) {
  return request({
    url: lifeServiceApi + baseApi + `/${id}/status`,
    method: 'Patch',
    data: {
      status
    }
  })
}
